package com.ddsfec.homepagerest.controller;

import com.ddsfec.homepagerest.entity.ResultBean;
import com.ddsfec.homepagerest.service.EvaluateService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 评论
 */
@CrossOrigin
@RequestMapping("/evaluate")
@RestController
public class EvaluateController {

    @Resource
    EvaluateService evaluateService;

    @RequestMapping("/listByUser")
     public ResultBean checkEvaluatesByUser(@RequestParam(value = "token")String token,@RequestParam(value = "userId" ,required = true)String userId){
        if(token==null){
            ResultBean resultBean= new ResultBean();
            resultBean.setCode(1L);
            resultBean.setMsg("token is null");
            return resultBean;
        }
         return evaluateService.checkEvaluatesByUser(userId);
     }

}
